#pragma once

#include <gl/glfw.h>
#include <cyclone/cyclone.h>
#include "ballobject.h"
#include "boxobject.h"
#include "ragdollbody.h"
#include "app.h"
#include "timing.h"
#include <stdio.h>

#define OBJECTS 3
#define COCONUT_AMOUNT 3

using std::vector;
/**
 * The main demo class definition.
 */
class CoconutGame : public RigidBodyApplication
{
	//GAME VARIBLES 
    bool editMode, upMode;
	float playerVelocity;
	float playerZposition;
	float playerYposition;
	int playerScore;
	int playerMisses;
	int playerHits;
	int overallPlayerHits;
	bool HEADSHOT;
	int ballcounter;

	//RAGDOLL BODY STORAGE
	vector<Bone*> *enemy_Bones;
	vector<vector<Bone*>*> *enemies_Bones;
	vector<cyclone::Joint*> *enemy_Joints;
	vector<vector<cyclone::Joint*>*> *enemies_Joints;
    /** 
     * Holds the number of boxes in the simulation.
     */
    const static unsigned boxes = OBJECTS;

    /** Holds the box data. */
    Box boxData[boxes];


    /** 
     * Holds the number of balls in the simulation.
     */
    const static unsigned balls = 1;//OBJECTS;

    /** Holds the ball data. */
    Ball ballData[balls];


    /** Detonates the explosion. */ 
    void fire();

    /** Resets the position of all the boxes and primes the explosion. */
    virtual void reset();

	/** Processes the contact generation code. */
	virtual void generateContacts();

    /** Processes the objects in the simulation forward in time. */
    virtual void updateObjects(cyclone::real duration);

public:
    /** Creates a new demo object. */
    CoconutGame();

	void UI();
    /** Sets up the rendering. */
    virtual void initGraphics();

    /** Returns the window title for the demo. */
    virtual const char* getTitle();

    /** Display the particle positions. */
    virtual void display();

    /** Handles a key press. */
    virtual void key();
};
